package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "9021000137681626";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCNNVDs6yAl0QbLFEKIZATesXQ7cy6eYQFgit/4II5zAByPUGnsLoo/+7Eb/XL42fFb2C1GIuG1J9QGyyaltEu7Cjao1n6+NvC/xlngaojJPlWgPmdShBb3Zhav6W4OLub6VY8RPJcQXd0T8eaM+FD+3IS2DuLcuNQpb87Z5YH0RV16Rk/PfQogZD4BMHwA8wjUVaA0+69nQyyZBxORNJNDEUQF/bvi8jwvRtrC380VXBTKZ4leRp1lNCbZULmjYNMcVNqTcBsJg4WR1BOJTge+1flXczeJHG0HKmDm/txEJZYx645yl18cZcfSRcjCA4ikLAqCgq3MP1QRYb2KWb4pAgMBAAECggEAUFk1GgpUOZBt6CI4FXmsF7crpyRMM4yJBxEejgagZ6l5lsav7tcwjWW/Cmk2AYmpv5QLduwkODtYdyEjdYhYyy3tmjaq2btTVBweSgb0nGYevNalXhuRIebyI9iUafegMHN8u9cZMhPm1xF/GVm2ZL6/uQRRbDyzZHydW/ku7/mnj6NoWr+t4nIGQUBIekqo5eyPJJJZEJ8POKi+D67ZvCnZH+ONT/GoBOmaRa6zjBU7O71UfUBicDUX5+3hY23z0SuaKFigQCxC0OEe+XyzENjx2S9qm7RecaCQ9/YfvKi8/EsYoANYzEtbjM2kNFwh+LDl2xnkW920VQExbmZ3MQKBgQDoYDC1t1mqE32h9b2tZHXKoFRGU254hSyHxDrLTCogxZkpPSKEIjeBnbIj22mgqCMIYV+GeJeluzlKOebYDRaltZcmTqZ1No/4PM8TqnC2UFDeEkM14Gp4VmEHufmPSMR7uAF0hUZFjHfT9it8DPS581ltKvlGD5Vg6qM+4FwvXQKBgQCbkGbQZtLhLAUpGLNxNcLyueOJSFDzHqLhthrqQ+wkf2FmfGdibb8TFMWzidL+HgmVCwoqU0otv6mfGV0W8/BSFG18OUpY6SfpNFfI3xfix3D3h9LUirWUWSRU/dLdvL9QMa5ev0Yfxwa+LorWGhYvVhxHRP1Lt0uI/LvpG4X5PQKBgQCVHmUjt21Kvwc4D8KQqo8MYKa0GoYhwRQ6a6pvG4lNToBi/mBP+sUz4EaYzAyUlFEm55WtbWWjbOnuwAlrS7rkzAsbAg2/2iu5WQxpyk5aMGA0ofOPd1vbrVLG6olDcabk3cfRRlU5/FJJKwfsq0PAsHEKpTEhzI5Hi0sG5mNB4QKBgQCUvMNg/P8h5hnlCkX/t1x3AX7pcqhbW+52isw/MsQkvVoeSFH9DVuE3faNS/jdmVCmHZERmOMyzK9cfD7CRGiBwiBQhuJsEjljwvUwDQZkgTakpUvShfFJLtYLIUktU1tETMwgsRdWKNBspEmAnh6aEeYlynO4oj9pceQk5Hj7LQKBgE0EQ4H6I26+Uikda0zXyQfO3RDHPxjiCU8tqoTGABdv7MqSt0yII6gLpXuk5xKT39hQoDwpnAZCD6apff58qrGyNLuwKskTeG/PyyqvMipMRuLyhtNAk+CN+zKH0EnTNG54+Ktfujg7EE5LbSeaDeZnjQPRNnBB/O+ErKNA+DIQ";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAguOKkYWj3VTbwR5iMJFxvyg6Fy7qKxbMI2S6499edgpZs8xLvuzxnNXqCVtOMDKX/p7Y3icqXSdci+EBJeWqKXV5kU1YDr9UpaXlRJJwpzWf6FxI6VNRBDOMvAnoW+2fodFtfPX/wa620ifbZ0vzdjR/I0xt8ypu5/2VVxSfSieLd/TH0d1umOSX7jHa8Ibfc5K0wsJQrUp7ywE6qnhkTwp1UNN/RrQ0Pz60ZH0w6V6eJDq06GOn66SSOdIa41SDoT9TsyGJDEdlsUCR1I+FOx3KzKp7Z7AbhHGeNa8W+8I9ZoJAlysFuwO+IfpU8CwnvuzVnEWROUA+7iRrIDTb7QIDAQAB";
	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

